package com.snopy.designPattern.chainOfResponsibility.inter;

/**
 * @author snopy
 * @version 1.0.0
 * @classname AbstractLogger
 * @description
 * @email 77912204@qq.com
 * @date 2022/03/03 23:56
 */
public abstract class AbstractLogger {
    public static final int INFO = 1;
    public static final int DEBUG = 2;
    public static final int ERROR = 3;
    protected int level;
    private AbstractLogger next;

    public void setNext(AbstractLogger next) {
        this.next = next;
    }
    public void logMessage(int level,String message){
        if (this.level <= level){
            write(message);
        }

        if (next!=null){
            next.logMessage(level,message);
        }

    }
    public abstract void write(String message);
}
